/*
 * Matrix3x3.h
 *
 *  Created on: 02-11-2012
 *
 */

#ifndef MATRIX3X3_H_
#define MATRIX3X3_H_

#include <GlobalData.h>
#include "EVector3.h"

/**
 * Matrix4x4 assumes column-major order as default, as this format is expected by OpenGL.
 * That way the first 4 members in memory (of this->data) describe side vector and further ones describe up, forward and translation.
 */
template <typename TYPE>
class Matrix3x3
{
private:
	TYPE data2D[3][3];

public:

#pragma region Accessors
	// Ideally, switching column and row indexing order in all accessors should result in acquiring row-major order as the implementation is being done with that in mind, but it should be double checked before enabling such functionality.
	// NOTE: this will not work as matrices are passed to shaders by an address of at(0, 0).
	inline TYPE& at(uint row, uint column);
	inline TYPE get(uint row, uint column) const;
	inline void set(uint row, uint column, TYPE value);
#pragma endregion

	Matrix3x3();
	Matrix3x3(const Matrix3x3& other);
	Matrix3x3(const Vector3<TYPE>& translation);

    inline Matrix3x3& 	setIdentity				();
    static Matrix3x3 	getIdentity				();
    Matrix3x3& 			transpose				();
    Matrix3x3 			getTransposed			() const;
    Matrix3x3 			getInversedTransposed	() const;

//    static Matrix4x4 	createRotationX			(TYPE angle);
//    static Matrix4x4 	createRotationY			(TYPE angle);
//    static Matrix4x4 	createRotationZ			(TYPE angle);
//    Matrix4x4& 		rotateX					(TYPE angle);
//    Matrix4x4& 		rotateY					(TYPE angle);
//    Matrix4x4& 		rotateZ					(TYPE angle);

    void 				operator*=				(const Matrix3x3<TYPE>& other);
};

template <typename TYPE>
Matrix3x3<TYPE> operator*(const Matrix3x3<TYPE>& a, const Matrix3x3<TYPE>& b);


#endif /* MATRIX3X3_H_ */
